import { _get, _post } from "../../utils/request";
import util from "../../utils/util";
const app = getApp();

Page({
    data: {
        activeIndex: 1,
        items: [
            // {
            //     title: "步骤1",
            //     description: "这是步骤1",
            // },
        ],
        gongdan: []
    },
    getConfirm() {
        _get(`/myTest/selectTestResultByWorkerId`, { workerId: app.confirmId }).then(res => {
            console.log('检测结果封面', res);
            app.testConfirmId = res.data.data.workerOrderResultId
            this.setData({
                title: res.data.title,
                gongdan: res.data.data,
                workerOrderResultId: res.data.data.workerOrderResultId
            })
        })
    },
    //获取确认工单页面详情
    // getConfirm() {
    //     const confirmId = app.confirmId;
    //     // console.log('confirmId', confirmId);
    //     const params = {
    //         vbizId: confirmId,
    //     };
    //     _get(`/confirmWorker/inAffirm`, params).then((res) => {
    //         console.log("confirm流转记录", res);
    //         this.setData({
    //             title: res.data.title,
    //         })
    //         let steps = res.data.data;
    //         for (let i = 0; i < steps.length; i++) {
    //             this.setData({

    //                 activeIndex: i + 1,
    //                 items: this.data.items.concat([{
    //                     title: steps[i].content,
    //                     description: steps[i].creatDate,
    //                 }, ]),
    //             });
    //         }
    //     });
    // },
    //确认工单
    confirm_btn() {
        const confirmId = app.confirmId;
        const params = {
            vbizId: confirmId,
            userId: app.userId
        };

        // dd.navigateTo({
        //         url: '/pages/choose_mb/choose_mb'
        //     })
        _get(`/confirmWorker/affirmWorker`, params).then(res => {
            console.log(res);
            dd.reLaunch({
                url: '/pages/home/home'
            })
        })

    },
    onLoad() {
        dd.setNavigationBar({
            title: '确认工单',
            backgroundColor: '#142e4f',
            success() {},
            fail() {},
        });
    },
    onReady() {
        this.getConfirm();
    },
});